<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>布尔值关灯</title>
</head>

<body>
    <img id="d" src="./img/pic_bulbon.gif">
    <button onclick="kaideng()">开灯</button>
    <button onclick="guandeng()">关灯</button>
</body>
<script>
    function kaideng() {
        let img = document.getElementById("d");
        img.src = "./img/pic_bulbon.gif";
    }
    function guandeng() {
        let img = document.getElementById("d");
        img.src = "./img/pic_bulboff.gif";
    }
</script>

</html>